import request from "@/utils/request";
export default {
  getPageList(page, limit, searchObj) {
    return request({
      url: `/front/stu/course/list/${page}/${limit}`,
      method: "post",
      data: searchObj
    });
  },
  getPageCollect(page, limit) {
    return request({
      url: `/front/stu/course/collect/${page}/${limit}`,
      method: "get"
    });
  },
  getAdminPageList(page, limit, searchObj) {
    return request({
      url: `/admin/stu/course/list/${page}/${limit}`,
      method: 'get',
      params: searchObj
    })
  },
  // 获取课程二级分类
  getNestedTreeList2() {
    return request({
      url: `/admin/stu/subject/list`,
      method: "get"
    });
  },
  //根据课程id获取课程详情
  getCourseInfo(courseId) {
    return request({
      url: `/front/stu/course/get/${courseId}`,
      method: "get"
    });
  },
  removeCourseById(id) {
    return request({
      url: `/admin/stu/course/remove`,
      method: 'delete',
      params: { id: id }
    })
  },
  saveCourseInfo(courseInfo) {
    return request({
      url: `/admin/stu/course/save/courseInfo`,
      method: 'post',
      data: courseInfo
    })
  },
  rateCourse(commentInfo) {
    return request({
      url: `/front/stu/course/rate`,
      method: 'post',
      data: commentInfo
    })
  },
  getCourseInfoById(courseId) {
    return request({
      url: `/admin/stu/course/get/${courseId}`,
      method: 'get'
    })
  },

  getCoursePublishInfoById(id) {
    return request({
      url: `/admin/stu/course/get/publishCourseInfo/${id}`,
      method: 'get'
    })
  },

  publishCourseById(id) {
    return request({
      url: `/admin/stu/course/publishCourse/${id}`,
      method: 'put'
    })
  }
};
